#include "client.h"
#include <iostream>

ClientEndpoint::ClientEndpoint(const std::string& address){
    context = zmq::context_t();
    socket = zmq::socket_t(context, zmq::socket_type::req);
    socket.connect(address);
}

void ClientEndpoint::sendRequest(const std::string& request) {
    socket.send(zmq::buffer(request), zmq::send_flags::none);
    std::cout << "Sent: " << request << std::endl;
}

std::string ClientEndpoint::receiveReply() {
    zmq::message_t reply;
    socket.recv(reply, zmq::recv_flags::none);
    std::cout << "Received: " << reply.to_string() << std::endl;
    return reply.to_string();
}
